const domainName = getApp().globalData.domainName
const parameter = getApp().globalData.parameter

const basic_info_init=(that, user_id)=>{
  wx.request({
    url: domainName + '/basic_info_init',
    data: {
      user_id
    },...parameter,
    success:res => {
      that.setData({
        avatar:res.data.avatar,
        nick_name:res.data.nick_name,
        gender:res.data.gender,
        phone:res.data.phone,
        birthday:res.data.birthday,
        real_name:res.data.real_name,
        address:res.data.address,
        id_no:res.data.id_no,
      })
    },
  })
}
// pages/personal_info/personal_info.js
Page({

  /**
   * 页面的初始数据
   */
  data: {
  },



  // 修改头像
  update_avatar(){
    wx.navigateTo({
      url: '/pages/users/update_avatar/update_avatar?avatar=' + this.data.avatar,
    })
  },

  // 修改手机号
  update_phone(){
    getApp().get_vibration()
    wx.navigateTo({
      url: '/pages/users/update_phone/update_phone?phone=' + this.data.phone,
    })
  },
  update_nick_name(e){
    wx.navigateTo({
      url: '/pages/users/update_nickName/update_nickName?nick_name=' + this.data.nick_name,
    })
  },

    // 前往实名认证页面
    go_cert(){
      getApp().get_vibration()
      wx.navigateTo({
        url: '/pages/users/identification/identification?user_id=' + this.user_id,
      })
    },
  
  onLoad(options){
    console.log('options',options)
    this.user_id = options.user_id
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onShow: function () {
    basic_info_init(this, this.user_id)
  },

})